from xmlrpclib import ServerProxy

rcv_path = '/Users/liushuai/temp/receive'

sp = ServerProxy("http://localhost:8000")  
while True:
	print sp.getFileList()
	choice = int(raw_input('Input file index you want:'))
	if choice == -1:
		break
	name = sp.getFileName(choice)
	f = open('/'.join((rcv_path, name)), 'wb')
	f.write(sp.getFile(choice).data)
	print name, 'receive successfully!'
